package main

import (
	"fmt"
	"net/rpc"
)

func main() {
	//1.用rpc.dial和rpc服务器进行连接
	conn, err := rpc.Dial("tcp", "127.0.0.1:8800")
	if err != nil {
		fmt.Println(err)
	}
	//2.程序退出则关闭
	defer conn.Close()
	//3.调用远程程序
	var reply string
	err = conn.Call("Hello.SayHello", "我是客户端", &reply)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(reply)
}
